package org.javaboy.provider.controller;

import org.javaboy.commons.inter.IUserService;
import org.javaboy.commons.model.User;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController implements IUserService {

    public User getUserById(Integer id, String token) {
        System.out.println("token = " + token);
        return new User(id, "javaboy");
    }

    @Override
    public User addUser(String username, Integer id) {
        return new User(id, username);
    }

    /**
     * 添加用户，key-value 格式的参数
     *
     * @param user
     * @return
     */
    public User addUser(User user) {
        return user;
    }

    /**
     * JSON 参数
     *
     * @param user
     * @return
     */
    public User updateUser(User user) {
        System.out.println("user = " + user);
        return user;
    }

    public void deleteUser(Integer id) {
        System.out.println("deleteUser id=" + id);
    }
}
